package receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import application.UIApplication;

/**
 * Created by yanglei on 15/9/26.
 */
public abstract class DownloadErrorReceiver extends BroadcastReceiver {
    public static final String Action = UIApplication.PackageName+".Receiver.DownloadError";
    @Override
    public void onReceive(Context context, Intent intent) {
        if (Action.equals(intent.getAction())){
            //
            String tag = intent.getStringExtra("tag");
            String url = intent.getStringExtra("url");
            String msg = intent.getStringExtra("msg");
            DownloadError(context, intent,url,msg,tag);
        }
    }

    /**
     * 下载中出现错误
     * @param context
     * @param intent
     * @param url 下载地址
     * @param errorMsg 错误信息
     * @param tag 自定义标识
     */
    public abstract void DownloadError(Context context, Intent intent,String url,String errorMsg,String tag);
}
